//岗位的请求封装
import request from "@/utils/http.ts"

//1.添加岗位
export const addJobAPI = (data: any) => {
    return request({
        url: 'job/addJob',
        method: 'post',
        data: {
            jobStatus: data.jobStatus,
            jobEmployerId: data.jobEmployerId,
            jobTitle: data.jobTitle,
            jobDescription: data.jobDescription,
            jobRequirements: data.jobRequirements,
            jobLocation: data.jobLocation,
            jobType: data.jobType,
            jobSalary: data.jobSalary,
            jobSalaryType: data.jobSalaryType,
            jobWorkingHours: data.jobWorkingHours,
            jobGiveStartDate: data.jobGiveStartDate,
            jobGiveEndDate: data.jobGiveEndDate,
            jobStartDate: data.jobStartDate,
            jobEndDate: data.jobEndDate,
        }
    })
}

//2-1.分页查询岗位
export const pageJobAPI = (data: any) => {
    return request({
        url: 'job/pageJob',
        method: 'post',
        data: {
            pageCurrent: data.pageCurrent,
            pageSize: data.pageSize,
            jobAdminStatus: data.jobAdminStatus,
            jobStatus: data.jobStatus,
            jobEmployerId: data.jobEmployerId,
            jobLocation: data.jobLocation,
            jobType: data.jobType,
            jobSalaryType: data.jobSalaryType,
            searchName: data.searchName,
        }
    })
}
//2-2.分页查询岗位和企业信息
export const pageJobAndEmployerAPI = (data: any) => {
    return request({
        url: 'job/pageJobAndEmployer',
        method: 'post',
        data: {
            pageCurrent: data.pageCurrent,
            pageSize: data.pageSize,
            jobAdminStatus: data.jobAdminStatus,
            jobStatus: data.jobStatus,
            jobEmployerId: data.jobEmployerId,
            jobLocation: data.jobLocation,
            jobType: data.jobType,
            jobSalaryType: data.jobSalaryType,
            searchName: data.searchName,
        }
    })
}

//3-1.根据id查询岗位详情
export const getJobDetailByJobIdAPI = (jobId: string) => {
    return request({
        url: 'job/getJobDetailByJobId',
        method: 'post',
        params: {
            jobId: jobId
        }
    })
}

//3-2.根据id查询岗位详情和企业信息
export const getJobDetailAndEmployerByJobIdAPI = (jobId: string) => {
    return request({
        url: 'job/getJobAndEmployerDetailByJobId',
        method: 'post',
        params: {
            jobId: jobId
        }
    })
}

//4.根据id修改岗位信息
export const updateJobByIdAPI = (data: any) => {
    return request({
        url: 'job/updateJobById',
        method: 'post',
        data: {
            jobId: data.jobId,
            jobStatus: data.jobStatus,
            jobTitle: data.jobTitle,
            jobDescription: data.jobDescription,
            jobRequirements: data.jobRequirements,
            jobLocation: data.jobLocation,
            jobType: data.jobType,
            jobSalary: data.jobSalary,
            jobSalaryType: data.jobSalaryType,
            jobWorkingHours: data.jobWorkingHours,
            jobGiveStartDate: data.jobGiveStartDate,
            jobGiveEndDate: data.jobGiveEndDate,
            jobStartDate: data.jobStartDate,
            jobEndDate: data.jobEndDate,
        }
    })
}

//5.根据id删除岗位
export const deleteJobByIdAPI = (jobId: string) => {
    return request({
        url: 'job/deleteJobById',
        method: 'post',
        params: {
            jobId: jobId
        }
    })
}

//6.管理员-修改岗位状态
export const updateJobAdminStatusByIdAPI = (data: any) => {
    return request({
        url: 'job/updateJobAdminStatusById',
        method: 'post',
        params: {
            jobId: data.jobId,
            jobAdminStatus: data.jobAdminStatus,
        }
    })
}

//7.管理员-分页获取岗位
export const getJobAdminPageAPI = (data: any) => {
    return request({
        url: 'job/getJobAdminPage',
        method: 'post',
        data: {
            pageCurrent: data.pageCurrent,
            pageSize: data.pageSize,
            jobAdminStatus: data.jobAdminStatus,
            jobStatus: data.jobStatus,
            jobEmployerId: data.jobEmployerId,
            jobLocation: data.jobLocation,
            jobType: data.jobType,
            jobSalaryType: data.jobSalaryType,
            searchName: data.searchName,
        }
    })
}
